package com.dj.mingkong.portal.biz.controller.music;

import com.dj.mingkong.common.annotation.HasRoles;
import com.dj.mingkong.common.enums.RoleEnum;
import com.dj.mingkong.common.infrastructure.base.dto.rest.RestResponse;
import com.dj.mingkong.portal.biz.controller.music.vo.response.TypeVo;
import com.dj.mingkong.portal.biz.service.music.TypeService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 音乐类型管理
 *
 * @author zenglonghui
 * @date: 2023/4/12 16:08
 */
@RestController
@RequestMapping("/type")
@HasRoles(RoleEnum.MUSICIAN)
public class TypeController {
    @Resource
    private TypeService typeService;

    /**
     * 获取所有父类型
     *
     * @return 对象集合
     */
    @GetMapping("/getParentList")
    public RestResponse<List<TypeVo>> getParentList() {

        return RestResponse.success(typeService.getParentList());
    }

    /**
     * 获取树形结构音乐标签 用于下拉框选择
     *
     * @return List<TypeVo>
     */
    @GetMapping("/listTree")
    public RestResponse<List<TypeVo>> listTree() {

        return RestResponse.success(typeService.listTree());
    }

    /**
     * 获取所有音乐标签 用于下拉框选择
     *
     * @return List<TypeVo>
     */
    @GetMapping("/listAll")
    public RestResponse<List<TypeVo>> listAll() {

        return RestResponse.success(typeService.listAll());
    }
}
